package com.example.uberorganizer;


import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;


//Okno dodawania wydarzenia
public class ListDialog extends DialogFragment {
	 private ListView mainListView; 
	 private ArrayAdapter<String> mylistAdapter;  
	@Override
	public Dialog onCreateDialog(Bundle savedInstanceState) {
	    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
	    // Get the layout inflater
	    LayoutInflater inflater = getActivity().getLayoutInflater();
	    // Inflate and set the layout for the dialog
	    // Pass null as the parent view because its going in the dialog layout
	    View v = inflater.inflate(R.layout.list_dialog, null);
	    builder.setView(v)
	    // Add action buttons
	           .setPositiveButton("Ok", new DialogInterface.OnClickListener() {
	        	   //Na przycisku OK dodajemy wydarzenie na Cancel wychodzimy z okna
	               @Override
	               public void onClick(DialogInterface dialog, int id) 
	               {
	            	   ListDialog.this.getDialog().cancel();
	               }
	           }); 
	    
	    mainListView = (ListView) v.findViewById( R.id.mainListView );  
	    mainListView.setAdapter( mylistAdapter ); 
	    return builder.create();
	}
	public void setArguments(ArrayAdapter<String> listAdapter) {
		 mylistAdapter = listAdapter;
		
	}
	

}
